<?php
class User extends AppModel{
    var $name='User';
    
    function check_login($data) {   
        // init   
        $valid = false;   
           
        // find user from the database with the username   
        $user = $this->find('first', array(   
            'conditions' => array(   
                'User.username'=>$data['User']['username']   
            )   
        ));   
           
        // if the passwords match   
        if($user['User']['password'] == $data['User']['password']) {   
            $valid = $user;   
        }   
           
    return $valid;   
    }   
}
?>
